import java.util.Scanner;

public class ArrayStatistics {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入数组大小: ");
        int n = scanner.nextInt();

        int[] arr = new int[n];
        System.out.println("请输入数组的元素:");
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }

        int max = arr[0], min = arr[0], sum = 0;
        for (int num : arr) {
            if (num > max) max = num;
            if (num < min) min = num;
            sum += num;
        }

        double avg = (double) sum / n;

        System.out.println("最大值: " + max);
        System.out.println("最小值: " + min);
        System.out.println("平均值: " + avg);
        System.out.println("总和: " + sum);
    }
}
